package com.wondream.myframework.design_pattern.decorator.io;

import java.io.*;
import java.nio.charset.StandardCharsets;

public class IODecoratorTest {
    public static void main(String[] args) throws Exception{
        InputStream is = new ByteArrayInputStream("ABC".getBytes(StandardCharsets.UTF_8));
        OutputStream os = new ByteArrayOutputStream();
        DataOutput dos = new DataOutputStream(os);
        String fileName = "./tmp/a.txt";
        DataOutput out = new RandomAccessFile(fileName, "rw");
        out.writeUTF("hello world!");
        System.out.println("[[IODecoratorTest.main]] write done.");

        FileInputStream fis = new FileInputStream(fileName);
        DataInput input = new RandomAccessFile(fileName, "rw");
        System.out.println("[[IODecoratorTest.main]] content:"+input.readLine());
    }
}
